package com.cetc.sdp.kmga.cs.schema.v2;

import com.alibaba.fastjson.JSONArray;
import com.cetc.sdp.kmga.cs.common.TableMapping;

import java.io.Serializable;
import java.util.List;

/**
 * @description:
 * @author： DengQiang
 * @date: 2018/2/7 11:04
 */
@Deprecated
public class AuditDbSchemaDescV2 extends IndexSchemaDesc<AuditDbSchemaDescV2.LogFieldIndex> {

    public AuditDbSchemaDescV2(TableMapping tm) {
        super(tm, LogFieldIndex.class);
    }

    public AuditDbLog buildAuditDbLog(JSONArray jsonArray) {
        List<String> data = buildLog(jsonArray);
        return new AuditDbLog(data, logFieldIndex);
    }

    public static class AuditDbLog implements Serializable {

        private List<String> data;
        private LogFieldIndex logFieldIndex;

        private AuditDbLog(List<String> data, LogFieldIndex logFieldIndex) {
            this.data = data;
            this.logFieldIndex = logFieldIndex;
        }

        public String get(int index) {
            return data.get(index);
        }

        public String getId() {
            return this.data.get(logFieldIndex.ID);
        }

        public void setId(String id) {
            if (id != null) {
                this.data.set(logFieldIndex.ID, id);
            }
        }

        public String getAuditId() {
            return this.data.get(logFieldIndex.AUDIT_ID);
        }

        public void setAuditId(String auditId) {
            if (auditId != null) {
                this.data.set(logFieldIndex.AUDIT_ID, auditId);
            }
        }

        public String getTime() {
            return this.data.get(logFieldIndex.TIME);
        }

        public void setTime(String time) {
            this.data.set(logFieldIndex.TIME, time);
        }

        public String getUsr() {
            return this.data.get(logFieldIndex.USR);
        }

        public void setUsr(String usr) {
            this.data.set(logFieldIndex.USR, usr);
        }

        public String getClientIp() {
            return this.data.get(logFieldIndex.CLIENT_IP);
        }

        public void setClientIp(String clientIp) {
            this.data.set(logFieldIndex.CLIENT_IP, clientIp);
        }

        public String getClientPort() {
            return this.data.get(logFieldIndex.CLIENT_PORT);
        }

        public void setClientPort(String clientPort) {
            this.data.set(logFieldIndex.CLIENT_PORT, clientPort);
        }

        public String getClientMac() {
            return this.data.get(logFieldIndex.CLIENT_MAC);
        }

        public void setClientMac(String clientMac) {
            this.data.set(logFieldIndex.CLIENT_MAC, clientMac);
        }

        public String getClientUsr() {
            return this.data.get(logFieldIndex.CLIENT_USR);
        }

        public void setClientUsr(String clientUsr) {
            this.data.set(logFieldIndex.CLIENT_USR, clientUsr);
        }

        public String getClientHost() {
            return this.data.get(logFieldIndex.CLIENT_HOST);
        }

        public void setClientHost(String clientHost) {
            this.data.set(logFieldIndex.CLIENT_HOST, clientHost);
        }

        public String getSesId() {
            return this.data.get(logFieldIndex.SES_ID);
        }

        public void setSesId(String sesId) {
            this.data.set(logFieldIndex.SES_ID, sesId);
        }

        public String getDataSrc() {
            return this.data.get(logFieldIndex.DATA_SRC);
        }

        public void setDataSrc(String dataSrc) {
            this.data.set(logFieldIndex.DATA_SRC, dataSrc);
        }

        public String getServerIp() {
            return this.data.get(logFieldIndex.SERVER_IP);
        }

        public void setServerIp(String serverIp) {
            this.data.set(logFieldIndex.SERVER_IP, serverIp);
        }

        public String getServerPort() {
            return this.data.get(logFieldIndex.SERVER_PORT);
        }

        public void setServerPort(String serverPort) {
            this.data.set(logFieldIndex.SERVER_PORT, serverPort);
        }

        public String getServerMac() {
            return this.data.get(logFieldIndex.SERVER_MAC);
        }

        public void setServerMac(String serverMac) {
            this.data.set(logFieldIndex.SERVER_MAC, serverMac);
        }

        public String getDbName() {
            return this.data.get(logFieldIndex.DB_NAME);
        }

        public void setDbName(String dbName) {
            this.data.set(logFieldIndex.DB_NAME, dbName);
        }

        public String getDbVers() {
            return this.data.get(logFieldIndex.DB_VERS);
        }

        public void setDbVers(String dbVers) {
            this.data.set(logFieldIndex.DB_VERS, dbVers);
        }

        public String getTblType() {
            return this.data.get(logFieldIndex.TBL_TYPE);
        }

        public void setTblType(String tblType) {
            this.data.set(logFieldIndex.TBL_TYPE, tblType);
        }

        public String getTblName() {
            return this.data.get(logFieldIndex.TBL_NAME);
        }

        public void setTblName(String tblName) {
            this.data.set(logFieldIndex.TBL_NAME, tblName);
        }

        public String getTblNum() {
            return this.data.get(logFieldIndex.TBL_NUM);
        }

        public void setTblNum(String tblNum) {
            this.data.set(logFieldIndex.TBL_NUM, tblNum);
        }

        public String getFldType() {
            return this.data.get(logFieldIndex.FLD_TYPE);
        }

        public void setFldType(String fldType) {
            this.data.set(logFieldIndex.FLD_TYPE, fldType);
        }

        public String getFldName() {
            return this.data.get(logFieldIndex.FLD_NAME);
        }

        public void setFldName(String fldName) {
            this.data.set(logFieldIndex.FLD_NAME, fldName);
        }

        public String getOper() {
            return this.data.get(logFieldIndex.OPER);
        }

        public void setOper(String oper) {
            this.data.set(logFieldIndex.OPER, oper);
        }

        public String getOperSent() {
            return this.data.get(logFieldIndex.OPER_SENT);
        }

        public void setOperSent(String operSent) {
            this.data.set(logFieldIndex.OPER_SENT, operSent);
        }

        public String getRowNum() {
            return this.data.get(logFieldIndex.ROW_NUM);
        }

        public void setRowNum(String rowNum) {
            this.data.set(logFieldIndex.ROW_NUM, rowNum);
        }

        public String getActTime() {
            return this.data.get(logFieldIndex.ACT_TIME);
        }

        public void setActTime(String actTime) {
            this.data.set(logFieldIndex.ACT_TIME, actTime);
        }

        public String getActResult() {
            return this.data.get(logFieldIndex.ACT_RESULT);
        }

        public void setActResult(String actResult) {
            this.data.set(logFieldIndex.ACT_RESULT, actResult);
        }

        public String getRetuCont() {
            return this.data.get(logFieldIndex.RETU_CONT);
        }

        public void setRetuCont(String retuCont) {
            this.data.set(logFieldIndex.RETU_CONT, retuCont);
        }

        public String getOrigRuleName() {
            return this.data.get(logFieldIndex.ORIG_RULE_NAME);
        }

        public void setOrigRuleName(String origRuleName) {
            this.data.set(logFieldIndex.ORIG_RULE_NAME, origRuleName);
        }

        public String getOrigDealState() {
            return this.data.get(logFieldIndex.ORIG_DEAL_STATE);
        }

        public void setOrigDealState(String origDealState) {
            this.data.set(logFieldIndex.ORIG_DEAL_STATE, origDealState);
        }

        public String getOrigRiskLev() {
            return this.data.get(logFieldIndex.ORIG_RISK_LEV);
        }

        public void setOrigRiskLev(String origRiskLev) {
            this.data.set(logFieldIndex.ORIG_RISK_LEV, origRiskLev);
        }

        public String getOrigObjName() {
            return this.data.get(logFieldIndex.ORIG_OBJ_NAME);
        }

        public void setOrigObjName(String origObjName) {
            this.data.set(logFieldIndex.ORIG_OBJ_NAME, origObjName);
        }

        public String getExte1() {
            return this.data.get(logFieldIndex.EXTE_1);
        }

        public void setExte1(String exte1) {
            this.data.set(logFieldIndex.EXTE_1, exte1);
        }

        public String getExte2() {
            return this.data.get(logFieldIndex.EXTE_2);
        }

        public void setExte2(String exte2) {
            this.data.set(logFieldIndex.EXTE_2, exte2);
        }

        public String getExte3() {
            return this.data.get(logFieldIndex.EXTE_3);
        }

        public void setExte3(String exte3) {
            this.data.set(logFieldIndex.EXTE_3, exte3);
        }

        public String getRuleId() {
            return this.data.get(logFieldIndex.RULE_ID);
        }

        public void setRuleId(String ruleId) {
            this.data.set(logFieldIndex.RULE_ID, ruleId);
        }

        public String getResrcId() {
            return this.data.get(logFieldIndex.RESRC_ID);
        }

        public void setResrcId(String resrcId) {
            this.data.set(logFieldIndex.RESRC_ID, resrcId);
        }

        public String getAuditObjId() {
            return this.data.get(logFieldIndex.AUDIT_OBJ_ID);
        }

        public void setAuditObjId(String auditObjId) {
            this.data.set(logFieldIndex.AUDIT_OBJ_ID, auditObjId);
        }

        public String getLevel() {
            return this.data.get(logFieldIndex.LEVEL);
        }

        public void setLevel(String level) {
            this.data.set(logFieldIndex.LEVEL, level);
        }

        public String getOperType() {
            return this.data.get(logFieldIndex.OPER_TYPE);
        }

        public void setOperType(String operType) {
            this.data.set(logFieldIndex.OPER_TYPE, operType);
        }

        public String getReptDeviceNum() {
            return this.data.get(logFieldIndex.REPT_DEVICE_NUM);
        }

        public void setReptDeviceNum(String reptDeviceNum) {
            this.data.set(logFieldIndex.REPT_DEVICE_NUM, reptDeviceNum);
        }

        public String getCreateTime() {
            return this.data.get(logFieldIndex.CREATE_TIME);
        }

        public void setCreateTime(String createTime) {
            this.data.set(logFieldIndex.CREATE_TIME, createTime);
        }

        public String getClusterType() {
            return this.data.get(logFieldIndex.CLUSTER_TYPE);
        }

        public void setClusterType(String clusterType) {
            this.data.set(logFieldIndex.CLUSTER_TYPE, clusterType);
        }

        public String getClusterId() {
            return this.data.get(logFieldIndex.CLUSTER_ID);
        }

        public void setClusterId(String clusterId) {
            this.data.set(logFieldIndex.CLUSTER_ID, clusterId);
        }
    }

    /**
     * 日志数组中字段的索引
     */
    public static class LogFieldIndex implements Serializable {

//        static final LogFieldIndex INDEX = new LogFieldIndex();
//
//        private LogFieldIndex() {
//        }

        public int ID =  -1;
        public int AUDIT_ID =  -1;
        public int TIME =  -1;
        public int USR =  -1;
        public int CLIENT_IP =  -1;
        public int CLIENT_PORT =  -1;
        public int CLIENT_MAC =  -1;
        public int CLIENT_USR =  -1;
        public int CLIENT_HOST =  -1;
        public int SES_ID =  -1;
        public int DATA_SRC =  -1;
        public int SERVER_IP =  -1;
        public int SERVER_PORT =  -1;
        public int SERVER_MAC =  -1;
        public int DB_NAME =  -1;
        public int DB_VERS =  -1;
        public int TBL_TYPE =  -1;
        public int TBL_NAME =  -1;
        public int TBL_NUM =  -1;
        public int FLD_TYPE =  -1;
        public int FLD_NAME =  -1;
        public int OPER =  -1;
        public int OPER_SENT =  -1;
        public int ROW_NUM =  -1;
        public int ACT_TIME =  -1;
        public int ACT_RESULT =  -1;
        public int RETU_CONT =  -1;
        public int ORIG_RULE_NAME =  -1;
        public int ORIG_DEAL_STATE = -1;
        public int ORIG_RISK_LEV =  -1;
        public int ORIG_OBJ_NAME =  -1;
        public int EXTE_1 =  -1;
        public int EXTE_2 =  -1;
        public int EXTE_3 =  -1;
        public int RULE_ID =  -1;
        public int RESRC_ID =  -1;
        public int AUDIT_OBJ_ID =  -1;
        public int LEVEL =  -1;
        public int OPER_TYPE =  -1;
        public int REPT_DEVICE_NUM = -1;
        public int CREATE_TIME =  -1;
        public int CLUSTER_TYPE =  -1;
        public int CLUSTER_ID =  -1;
    }
}
